package com.itany.servlet;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

// @WebServlet("/world")
// @WebServlet(urlPatterns = "/world")
// @WebServlet("/aa/*")
@WebServlet("*.do")
public class WorldServlet extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        // 设置响应的类型和字符集
        resp.setContentType("text/html;charset=utf8");

        // 获取打印输出流
        PrintWriter out = resp.getWriter();
        out.print("<h2>收到！</h2>");
        out.close();
    }
}
